package com.sx.epidemic_system.controller;

import com.sx.epidemic_system.service.NewAddService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/new")
public class NewAddController
{
    @Autowired
    private NewAddService newAddService;
    private List<Integer>list=new ArrayList<>();
//    新增确诊
    @RequestMapping("/getAllNewAdd")
    @ResponseBody
    public int getAllNewAdd() {
        return newAddService.getAllNewAdd();
    }
//    新增本土
    @RequestMapping("/getContinentNewAdd")
    @ResponseBody
    public int getContinentNewAdd(){
        return newAddService.getContinentNewAdd();
    }
//    新增境外
    @RequestMapping("/getOutSideNewAdd")
    @ResponseBody
    public int getOutSideNewAdd(){
        return newAddService.getOutSideNewAdd();
    }
//    新增无症状
    @RequestMapping("/getAsymptomatic")
    @ResponseBody
    public int getAsymptomatic(){
        return newAddService.getAsymptomatic();
    }
//    省内新增确诊
    @RequestMapping("/getAllNewAddProvince")
    @ResponseBody
    public int getAllNewAddProvince(String province){
        return newAddService.getAllNewAddProvince(province);
    }
//    省内新增本土
    @RequestMapping("/getContinentNewAddProvince")
    @ResponseBody
    public int getContinentNewAddProvince(String province){
        return newAddService.getContinentNewAddProvince(province);
    }
//    省内新增境外
    @RequestMapping("/getOutSideNewAddProvince")
    @ResponseBody
    public int getOutSideNewAddProvince(String province){
        return newAddService.getOutSideNewAddProvince(province);
    }
//    省内新增无症状
    @RequestMapping("/getAsymptomaticProvince")
    @ResponseBody
    public int getAsymptomaticProvince(String province){
        return newAddService.getAsymptomaticProvince(province);
    }

    @RequestMapping("/country")
    @ResponseBody
    public List<Integer>getNewAddCountry(){

        list.add(newAddService.getAllNewAdd());
        list.add(newAddService.getContinentNewAdd());
        list.add(newAddService.getOutSideNewAdd());
        list.add(newAddService.getAsymptomatic());
        return list;
    }
    @RequestMapping("/province")
    @ResponseBody
    public List<Integer>getNewAddProvince(String province){
        list.add(newAddService.getAllNewAddProvince(province));
        list.add(newAddService.getContinentNewAddProvince(province));
        list.add(newAddService.getOutSideNewAddProvince(province));
        list.add(newAddService.getAsymptomaticProvince(province));
        return list;
    }
}
